import { DictArray, DictWordMap, DictTranslatedWordMap, DictSynonymMap } from "../typing";

const globalDictionary: IGlobalDictionary = {
  // 词典组
  dictArray: [],

  // 以 word 为 key 的 hashMap
  dictWordMap: {},

  // 以 translatedWord 为 key 的 hashMap
  dictTranslatedWordMap: {},

  // 以 synonym 为 key 的 hashMap
  dictSynonymMap: {},

  // 单词组
  words: new Set(),

  // 转换后的单词组
  translatedWords: new Set(),

  // 近义词组
  synonyms: new Set(),

  // 全部单词组
  allWords: new Set(),

  // 近义词正则
  synonymsRegExp: new RegExp('', 'ig'),
};

export default globalDictionary;

export interface IGlobalDictionary {
  dictArray: DictArray,
  dictWordMap: DictWordMap,
  dictTranslatedWordMap: DictTranslatedWordMap,
  dictSynonymMap: DictSynonymMap,
  words: Set<string>,
  translatedWords: Set<string>,
  synonyms: Set<string>,
  allWords: Set<string>,
  synonymsRegExp: RegExp,
}
